package com.wanlian.dao;

import com.wanlian.common.PageCondition;
import com.wanlian.entity.Device;
import com.wanlian.model.ResultModel;
import com.wanlian.vo.DeviceListVo;
import com.wanlian.vo.Page;

import java.util.List;
import java.util.Map;

public interface DeviceDao extends GenericDao<Device> {

    ResultModel queryDevice(Page page, Map<String, Object> conditions);

    List<Device> queryDeviceByUser(Page page, String userName);

    List<Device> queryDeviceOnline();

    ResultModel queryDeviceByUser(Page page, int userId);

    List<Device> queryDevicesByUser(int userId);

    List<Device> queryDeviceOnlineAll();

    ResultModel deleteById(int deviceId);

    ResultModel deleteByDeviceId(String deviceId);

    /**
     * 启动设备
     *
     * @param id
     * @return
     */
    ResultModel doEnableById(int id);

    /**
     * 启用设备
     *
     * @param deviceId
     * @return
     */
    ResultModel doEnableByDeviceId(String deviceId);


    /**
     * 通过id bind
     *
     * @param deviceId
     * @param userId
     * @return
     */
    ResultModel bindDeviceById(int deviceId, int userId);

    /**
     * 通过设备编号来bind
     *
     * @param deviceKey
     * @param userId
     * @return
     */
    ResultModel doBindDeviceByDeviceKey(String deviceKey, int userId);


    /**
     * 通过设备编号查询
     *
     * @param deviceId
     * @return
     */
    Device queryByDeviceId(String deviceId);

    Device queryDeviceByUdid(String deviceId, int userId);

    Device queryByDeMac(String deviceId, String macAddress);

    /**
     * 通过mac地址查询
     *
     * @param mac
     * @return
     */
    Device queryByMac(String mac);

    Device queryByDeviceKey(String deviceKey);

    /**
     * 解除绑定
     *
     * @param
     * @return
     */
    Device doEditUntied(Device device, int userId);

    ResultModel queryDeviceByParams(PageCondition pageCondition, int userId);

    long queryUserDeviceCount(int userId);

    Device queryDeviceByUserId(int userId);

    void doSetDeviceCurrent(String deviceId, int userid);

    List<Device> queryAllByUserId(int userId);

    List<Device> queryDevicesByChannels(List<String> channels);

    List<Device> queryEnableDevicesByChannels(List<String> channels);

    Device queryCurrentByUserId(int userId);

    long queryDeviceCountToday();

    Device queryByMacNot(int id, String mac);

    Device queryByDeviceKeyNot(int id, String deviceKey);

    Map<String,Device>queryAllDevices();

     List<String> queryAllDeviceList();

    void EditBatch(List<Device> devices);

    void EditBatchLine(List<Device> devices);
}
